package mcom.xmks.bluetooth.mesh.storage;

import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;

public class NodeItem implements Parcelable {
    private String name;
    private int nodeAddress;
    private boolean state;
    protected NodeItem(Parcel parcel) {
        name = parcel.readString();
        nodeAddress = parcel.readInt();
        state = (boolean) parcel.readValue(Boolean.class.getClassLoader());
    }
    public NodeItem(String name,int nodeAddress,boolean state){
        this.name=name;
        this.nodeAddress=nodeAddress;
        this.state=state;
    }
    public String getName() {
        return name;
    }

    public int getNodeAddress() {
        return nodeAddress;
    }

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setNodeAddress(int nodeAddress) {
        this.nodeAddress = nodeAddress;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeString(name);
        parcel.writeInt(nodeAddress);
        parcel.writeValue(state);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<NodeItem> CREATOR = new Creator<NodeItem>() {
        @Override
        public NodeItem createFromParcel(Parcel parcel) {
            return new NodeItem(parcel);
        }

        @Override
        public NodeItem[] newArray(int size) {
            return new NodeItem[size];
        }
    };
}
